package com.scoy.honeymei.utils;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;

/**
 * ClassName:      com.scoy.honeymei.utils
 * Description:
 * Author:         GaoZhan & Administrator
 * UpdateDate:     2020/8/10/0010$ 15:07$
 * UpdateRemark:   更新内容
 */
public class PayUtils {

    public static void gotoAlipay(Activity activity, String payUrl) {
        Intent intent = new Intent();
        intent.setAction("android.intent.action.VIEW");
        intent.setData(Uri.parse("alipays://platformapi/startapp?appId=20000067&url=" + payUrl));

        if (intent.resolveActivity(activity.getPackageManager()) != null) {
            activity.startActivity(intent);
        } else {
            intent.setData(Uri.parse(payUrl));
            activity.startActivity(intent);
        }
    }

    public static void gotoWechat(Activity activity, String payUrl) {
        Intent intent = new Intent();
        intent.setAction("android.intent.action.VIEW");
        intent.setData(Uri.parse("weixin://dl/businessWebview/link/?appid=wxb4774b63d65a5718&url=" + payUrl));

        if (intent.resolveActivity(activity.getPackageManager()) != null) {
            activity.startActivity(intent);
        } else {
            intent.setData(Uri.parse(payUrl));
            activity.startActivity(intent);
        }
    }


}
